/**
 * 控制器基类.
 */

module.exports = class extends think.Controller {
    async __before() {
        const path = this.ctx.request.path;
        if (path.startsWith('/console') && !path.endsWith('/login')) {
            // 后台会话验证
            const adminInfo = await this.session('adminInfo');
            if (think.isEmpty(adminInfo)) {
                return this.redirect('/console/index/login');
            }
        }
    }
};
